﻿// Models/Exam.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace WebApplication1.Models
{
    /// <summary>
    /// 考试实体类
    /// </summary>
    [Table("Exams")]
    public class Exam
    {
        /// <summary>
        /// 考试ID
        /// </summary>
        [Key]
        public int ExamId { get; set; }

        /// <summary>
        /// 考试名称
        /// </summary>
        [Required(ErrorMessage = "考试名称不能为空")]
        [Display(Name = "考试名称")]
        [StringLength(200, ErrorMessage = "考试名称不能超过200个字符")]
        public string ExamName { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        [Display(Name = "描述")]
        public string Description { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Display(Name = "创建时间")]
        public DateTime CreatedDate { get; set; }

        /// <summary>
        /// 是否启用
        /// </summary>
        [Display(Name = "是否启用")]
        public bool IsActive { get; set; }

        /// <summary>
        /// 考试时长（分钟）
        /// </summary>
        [Display(Name = "考试时长（分钟）")]
        public int Duration { get; set; }

        [Display(Name = "合格分数")]
        public int PassScore { get; set; } // 添加合格分数属性

        /// <summary>
        /// 考试试题集合
        /// </summary>
        public virtual ICollection<Question> Questions { get; set; }

        /// <summary>
        /// 考试结果集合
        /// </summary>
        public virtual ICollection<ExamResult> ExamResults { get; set; }
    }
}